<ui:composition template="index.xhtml" 
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:f="http://java.sun.com/jsf/core">

	<ui:define name="content">
		<h:form id="addPost" enctype="multipart/form-data">
			<h2>#{strings['addPost.headline']}</h2>
			<h:panelGrid columns="3" columnClasses="titleCell">
                	<h:outputLabel for="title" value="Titel" />
                	<h:inputText id="title" value="#{newPost.title}" />
                	<h:message for="title" errorClass="text-error" />
                	
                	<h:outputLabel for="text" value="Text" />
                	<h:inputTextarea id="text" value="#{newPost.text}" />
                	<h:message for="text" errorClass="text-error" />
                	
                	<h:outputLabel for="image" value="Bild" />
                	<p:fileUpload id="image" value="#{postController.image}" mode="simple" />
                	<h:message for="image" errorClass="text-error" />
                	
                	<h:outputLabel for="video" value="Video" />
                	<p:fileUpload id="video" value="#{postController.video}" mode="simple" />
                	<h:message for="video" errorClass="text-error" />
			</h:panelGrid>

			<div>
				<h:panelGrid columns="2">
					<h:commandButton action="showPosts"
						value="#{strings['button.cancel']}" styleClass="btn btn-danger"
						rendered="#{authenticationBean.currentUser != null and topicBean.currentTopic != null}">
						<f:param name="id" value="#{topicBean.currentTopic.id}" />
					</h:commandButton>
					<h:commandButton id="register" action="#{postController.register}"
						value="#{strings['addPost.submit']}" styleClass="btn btn-primary" ajax="false" />
					
				</h:panelGrid>
				<div>
					<h:messages errorClass="text-error" infoClass="text-info" warnClass="text-warning" />
				</div>
			</div>
		</h:form>
	</ui:define>
</ui:composition>